import Entity from './entity'

export default class Element extends Entity {
    constructor(db) {
        super(db, 'elements')
    }

    async getAllByPage(page) {
        const list = await this.find(page ? { page } : {})
        return list
    }

    genToAddItem(item) {
        return {
            selector: item.selector,
            remark: item.remark,
            page: item.page,
            node: item.node
        }
    }

    genToUpdateItem(item) {
        return {
            selector: item.selector,
            remark: item.remark
        }
    }
}